/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bang;

/**
 *
 * @author Capucho
 */
public class Pilha {
    private No topo;
    private int tam;

    public void setTopo(No t){
            this.topo=t;
    }

    public No getTopo(){
            return this.topo;
    }

    public void setTam(int i){
            this.tam=i;
    }

    public int getTam(){
            return this.tam;
    }

    public void insereNo(No novo){
        if(getTam()==0){
            this.topo=novo;
            this.setTam(getTam()+1);
        }
        
        else{
            novo.setProx(this.topo);
            this.topo.setAnt(novo);
            this.setTopo(novo);
        }
    }
    
    public No getTopoRemove(){
        No aux;
        
        aux=this.topo;
        setTopo(this.topo.getProx());
                
        return aux;
    }
    
    
    //Construtor
    public Pilha(){
            this.tam=0;
            this.topo=null;
    }
}
